#include "SingletonFactory.h"

using namespace std;
using namespace singleton;

SingletonFactory *SingletonFactory::getFactory() {
    static SingletonFactory factory;
    return &factory;
}

void *SingletonFactory::getSingleton(const string &class_name) {
    if (singleton_map_.count(class_name) == 0) {
        return nullptr;
    }
    return singleton_map_.at(class_name).get();
}

void SingletonFactory::removeSingleton(const string &class_name) {
    singleton_map_.erase(class_name);
}